import request from "@/utils/request";
import qs from "qs";

// 查询执行策略管理列表
export function listPolicy(query) {
  return request({
    url: "/datascan/b/executionpolicy/queryPageList",
    method: "get",
    params: query,
  });
}

// 查询执行策略管理详细
export function getPolicy(query) {
  return request({
    url: "/datascan/b/executionpolicy/queryAuditTaskInfo",
    method: "get",
    params: query,
  });
}

// 立即执行
export function immediateExecuteTask(query) {
  return request({
    url: "/datascan/b/executionpolicy/immediateExecuteTask",
    method: "get",
    params: query,
  });
}

// 新增执行策略管理
export function addPolicy(data) {
  return request({
    url: "/datascan/b/executionpolicy/add",
    method: "post",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
    },
    data: qs.stringify(data),
  });
}

// 编辑执行策略管理
export function updatePolicy(data) {
  return request({
    url: "/datascan/b/executionpolicy/update",
    method: "post",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
    },
    data: qs.stringify(data),
  });
}

// 删除执行策略管理
export function delPolicy(data) {
  return request({
    url: "/datascan/b/executionpolicy/deleteByIds",
    method: "post",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
    },
    data: qs.stringify(data),
  });
}

// 停用
export function setTaskStatus(data) {
  return request({
    url: "/datascan/b/executionpolicy/setTaskStatus",
    method: "post",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
    },
    data: qs.stringify(data),
  });
}

export function dbgroupList(query) {
  return request({
    url: "/datascan/b/dbgroup/queryList",
    method: "get",
    params: query,
  });
}

export function dbInfoList(query) {
  return request({
    url: "/datascan/b/dbinfo/queryList",
    method: "get",
    params: query,
  });
}

export function querySystemWithDatabase(query) {
  return request({
    url: "/datascan/b/executionpolicy/querySystemWithDatabase",
    method: "get",
    params: query,
  });
}
export function setPause(query) {
  return request({
    url: "/datascan/b/executionpolicy/setPause",
    method: "get",
    params: query,
  });
}
